<template>
  <div class="my">
    <!-- 1.顶部内容 -->
    <header class="top_user">
      <!-- a.用户信息 -->
      <div class="userinfo">
        <div class="textinfo">
          <div class="username">{{ userinfo.nickname }}</div>
          <div class="usertext">{{ userinfo.intro }}</div>
        </div>
        <img
          v-if="userinfo.avatar === null"
          src="@/assets/logo.png"
          alt=""
          class="imginfo"
        />
        <img
          v-else
          :src="userAvatarURL + userinfo.avatar"
          alt=""
          class="imginfo"
        />
      </div>
      <!-- b.答题情况 -->
      <ul class="answer_info">
        <li class="answer_info_li">
          <div class="number">{{ userinfo.submitNum }}</div>
          <p class="sort">累计答题</p>
        </li>
        <li class="answer_info_li">
          <div class="number">298</div>
          <p class="sort">收藏题目</p>
        </li>
        <li class="answer_info_li">
          <div class="number">{{ userinfo.errorNum }}</div>
          <p class="sort">我的错题</p>
        </li>
        <li class="answer_info_li">
          <div class="number">298</div>
          <p class="sort">正确率</p>
        </li>
      </ul>
      <!-- c.我的岗位 -->
      <div class="mywork">
        <mycell
          :job="userinfo.position"
          myjob="我的岗位"
          leftIcon="&#xe64d;"
          rightIcon="&#xe653;"
        ></mycell>
      </div>
    </header>
    <!-- 2.中间数据 -->
    <div class="statistics_box">
      <div class="statistics">
        <!-- a.标题 -->
        <h3 class="title">面经数据</h3>
        <!-- b.具体数据 -->
        <ul class="statistics_detail">
          <li class="statistics_detail_li">
            <p class="yesterday">
              昨日阅读<span>+{{ userinfo.shareData.read.yesterday }}</span>
            </p>
            <div class="read_number">{{ userinfo.shareData.read.total }}</div>
            <div class="read_text">阅读总数</div>
          </li>
          <li class="statistics_detail_li">
            <p class="yesterday">
              昨日获赞<span>+{{ userinfo.shareData.star.yesterday }}</span>
            </p>
            <div class="read_number">{{ userinfo.shareData.star.total }}</div>
            <div class="read_text">获赞总数</div>
          </li>
          <li class="statistics_detail_li">
            <p class="yesterday">
              昨日新增<span>+{{ userinfo.shareData.comment.yesterday }}</span>
            </p>
            <div class="read_number">
              {{ userinfo.shareData.comment.total }}
            </div>
            <div class="read_text">评论总数</div>
          </li>
        </ul>
      </div>
    </div>
    <!-- 3.下面部分 -->
    <div class="my_interview_box">
      <div class="my_interview">
        <mycell
          job="21"
          myjob="我的面经分项"
          leftIcon="&#xe655;"
          rightIcon="&#xe653;"
          class="mycell"
        ></mycell>
        <mycell
          job="98"
          myjob="我的消息"
          leftIcon="&#xe656;"
          rightIcon="&#xe653;"
          class="mycell"
        ></mycell>
        <mycell
          job="32"
          myjob="收藏的题库"
          leftIcon="&#xe654;"
          rightIcon="&#xe653;"
          class="mycell"
        ></mycell>
        <mycell
          job="32"
          myjob="收藏的企业"
          leftIcon="&#xe648;"
          rightIcon="&#xe653;"
          class="mycell"
        ></mycell>
        <mycell
          job="123"
          myjob="我的错题"
          leftIcon="&#xe64f;"
          rightIcon="&#xe653;"
          class="mycell"
        ></mycell>
        <mycell
          job="166"
          myjob="收藏的面试经验"
          leftIcon="&#xe649;"
          rightIcon="&#xe653;"
          class="mycell"
        ></mycell>
      </div>
    </div>
  </div>
</template>

<script>
import Mycell from './mycell'
import { mapState } from 'vuex'
export default {
  components: {
    Mycell
  },
  data () {
    return {
      userAvatarURL: process.env.VUE_APP_URL
    }
  },
  computed: {
    ...mapState(['userinfo', 'islogin'])
  }
  // created () {
  //   console.log(this.$store.state.userinfo)
  // }
}
</script>

<style lang="less" scoped>
.my {
  padding-bottom: 20px;
  background: #f7f4f5;
  .top_user {
    padding: 0 @p15;
    width: 375px;
    height: 215px;
    background: linear-gradient(45deg, #ce0031, #b8002c);
    position: relative;
    .userinfo {
      height: 88px;
      display: flex;
      justify-content: space-between;
      align-content: center;
      align-items: center;
      .username {
        font-size: 21px;
        font-family: PingFangSC, PingFangSC-Semibold;
        font-weight: 500;
        text-align: left;
        color: #ffffff;
        line-height: 30px;
        letter-spacing: 0px;
      }
      .usertext {
        opacity: 0.7;
        font-size: 12px;
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 400;
        text-align: left;
        color: #ffffff;
        line-height: 16px;
        letter-spacing: 0px;
      }
      .imginfo {
        width: 50px;
        height: 50px;
        border: 3px solid rgba(255, 255, 255, 0.38);
        border-radius: 50%;
        margin-right: 8px;
      }
    }
    .answer_info {
      display: flex;
      justify-content: space-between;
      margin-top: 20px;
      padding: 0 8px;
      .answer_info_li {
        text-align: center;
        .number {
          font-size: 21px;
          font-family: DINAlternate, DINAlternate-Bold;
          font-weight: 500;
          text-align: center;
          color: #ffffff;
          line-height: 24px;
          letter-spacing: 0px;
        }
        .sort {
          opacity: 0.7;
          font-size: 12px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: center;
          color: #ffffff;
          line-height: 16px;
          letter-spacing: 0px;
          padding-top: 6px;
        }
      }
    }
    .mywork {
      width: 345px;
      height: 55px;
      background: #ffffff;
      border-radius: 8px;
      position: absolute;
      top: 176px;
      display: flex;
      align-items: center;
    }
  }
  .statistics_box {
    width: 100%;
    padding: 0 @p15;
    margin-top: 30px;
    .statistics {
      width: 345px;
      height: 142.5px;
      background: #ffffff;
      border-radius: 8px;
      padding: 0 @p15;
      .title {
        width: 57px;
        font-size: 14px;
        font-family: PingFangSC, PingFangSC-Semibold;
        font-weight: 700;
        text-align: center;
        color: #181a39;
        line-height: 20px;
        letter-spacing: 0px;
        padding-top: 19px;
        margin-bottom: 18px;
      }
      .statistics_detail {
        display: flex;
        justify-content: space-between;
        .statistics_detail_li {
          text-align: center;
          .yesterday {
            font-size: 10px;
            font-family: PingFangSC, PingFangSC-Regular;
            font-weight: 400;
            text-align: center;
            color: #b4b4bd;
            line-height: 14px;
            letter-spacing: 0px;
            span {
              color: #8cdeea;
            }
          }
          .read_number {
            font-size: 21px;
            font-family: DINAlternate, DINAlternate-Bold;
            font-weight: 700;
            text-align: center;
            color: #181a39;
            line-height: 24px;
            letter-spacing: 0px;
            padding-top: 10px;
            padding-bottom: 6px;
          }
          .read_text {
            font-size: 12px;
            font-family: PingFangSC, PingFangSC-Regular;
            font-weight: 400;
            text-align: center;
            color: #545671;
            line-height: 16px;
            letter-spacing: 0px;
          }
        }
      }
    }
  }
  .my_interview_box {
    width: 100%;
    margin-top: 10px;
    padding: 0 @p15;
    .my_interview {
      width: 345px;
      height: 321.5px;
      background: #ffffff;
      border-radius: 8px;
      overflow: hidden;
      .mycell {
        height: 53.58px;
      }
    }
  }
}
</style>
